<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title>分页界面</title>
    <link rel="stylesheet" type="text/css" href="${s.base}/lib/layui/css/layui.css"/>
    <link rel="stylesheet" type="text/css" href="${s.base}/css/base/index.css"/>
    <link rel="stylesheet" type="text/css" href="${s.base}/css/base/theme/theme.css"/>
</head>
<body>
<div class="wrap-container clearfix">
    <div class="column-content-detail">
        <form class="layui-form">
            <div class="search-cont clearfix" id="tool">
                <div class="operation-btn-cont">
                    <div class="operright cyt-retract-close hideMenu"> 收起筛选<i class="iconfont">&#xe658;</i></div>
                    <div class="operright cyt-retract-open showMenu" style="display: none;"> 展开筛选<i class="iconfont">&#xe936;</i></div>
                    <!--button开始-->
                    <button class="layui-btn layui-btn-normal layui-btn-mid" type="button" id="checkYesBtn"><i class="iconfont marr5">&#xe65e;</i>审核通过</button>
                    <button class="layui-btn layui-btn-normal layui-btn-mid" type="button" id="checkNoBtn"><i class="iconfont marr5">&#xe65e;</i>审核不通过</button>
                    <button class="layui-btn layui-btn-normal layui-btn-mid" type="button" lay-submit="" lay-filter="exportBtn"><i class="iconfont marr5">&#xe614;</i>批量导出</button>
                    <!--button结束-->
                    <div class="triangle-bottom"></div>
                    <div class="triangle-top"></div>
                </div>
                <div class="search-details">
                    <div class="layui-form-item marb5">
                        <!--search开始-->
                        <div class="layui-inline">
                            <label class="layui-form-label">姓名：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="name" placeholder="请输入姓名" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">电话号码：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="mobile" placeholder="请输入电话号码" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">身份证号：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="idCard" placeholder="请输入身份证号" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">是否外地返芜：</label>
                            <div class="layui-input-inline">
                                <select name="returnStatus" id="returnStatus"></select>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">是否经过疫区：</label>
                            <div class="layui-input-inline">
                                <select name="epidemicArea" id="epidemicArea"></select>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">审核状态：</label>
                            <div class="layui-input-inline">
                                <select name="verifyStatus" id="verifyStatus"></select>
                            </div>
                        </div>

                        <div class="layui-inline">
                            <label class="layui-form-label">小区地址：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="buildingInfo" placeholder="请输入小区地址" autocomplete="off" class="layui-input">
                            </div>
                        </div>

                        <div class="layui-inline">
                            <label class="layui-form-label">住户号：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="buildingRoom" placeholder="请输入住户号" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <!--search结束-->
                        <div class="layui-inline marl8">
                            <button class="layui-btn layui-btn-normal" type="button" lay-submit="" lay-filter="seacherBtn">搜索</button>
                            <button class="layui-btn layui-btn-normal" type="reset">重置</button>
                        </div>
                    </div>
                </div>
            </div>
        </form>
        <div class="layui-form" id="table-list">
            <table id="entityList" lay-filter="entityList" class="cy-list-table"></table>
        </div>
    </div>
</div>
<!--操作-->
<script type="text/html" id="entityBar">
    <a class="layui-btn layui-btn-radius layui-btn-primary layui-btn-sm layui-smbtn-green"  lay-event="edit">编辑</a>
    <a class="layui-btn layui-btn-radius layui-btn-primary layui-btn-sm layui-smbtn-green"  lay-event="record">出入小区记录</a>
   <!-- <a class="layui-btn layui-btn-radius layui-btn-primary layui-btn-sm layui-smbtn-green"  lay-event="temperature">健康管理</a>-->
    <button type="button" class="layui-btn layui-btn-radius layui-btn-primary layui-btn-sm layui-smbtn-red" lay-event="delete">删除</button>
</script>
<script src="${s.base}/lib/layui/layui.js" type="text/javascript" charset="utf-8"></script>
<script src="${s.base}/js/common.js" type="text/javascript" charset="utf-8"></script>
<script>
    var tableIns = null;
    layui.use(['jquery', 'table', 'page', 'dialog','form', 'selectN'], function () {
        var $ = layui.jquery,
            page = layui.page,
            table = layui.table,
            form = layui.form,
            selectN = layui.selectN,
            dialog = layui.dialog;

        //获取分页数据
        page.initDict('returnStatus,epidemicArea,certificateStatus,sexType,person_verify_status', function (dictData) {
            page.showDict($("#returnStatus"), page.aceeptDictContentList(dictData, 'returnStatus'), "全部");
            page.showDict($("#epidemicArea"), page.aceeptDictContentList(dictData, 'epidemicArea'), "全部");
            page.showDict($("#verifyStatus"), page.aceeptDictContentList(dictData, 'person_verify_status'), "全部");
            var url = "/work/antiepidemic/antiepidemicperson/page?applyId=${applyId}";
            var cols = [
                {type: 'checkbox', fixed: 'left'},
                {field: 'name', title: '姓名', align: 'center'},
                {field: 'mobile', title: '电话号码', align: 'center',width:150},
                {field: 'idCard', title: '身份证号', align: 'center',width:200},
                {field: 'carNumber', title: '车牌号', align: 'center',width:100,templet: function (d) {
                        if (d.carNumber != null && d.carNumber != "") {
                            return d.carNumber;
                        } else {
                            return "";
                        }
                    }
                },
                {field: 'buildingInfo', title: '小区住址', align: 'center',width:200},
                {field: 'buildingRoom', title: '住户号', align: 'center',width:100},
                {
                    field: 'returnStatus', title: '是否外地返芜', align: 'center',width:150, templet: function (d) {
                        return page.aceeptDictContentName(dictData, 'returnStatus', d.returnStatus);
                    }
                },
                {
                    field: 'returnTime', title: '返芜日期', align: 'center',width:150, templet: function (d) {
                        if (d.returnStatus == "0") {
                            return "无"
                        }  else if(d.returnTime != null && d.returnTime != "") {
                            return new Date(d.returnTime).Format("yyyy-MM-dd");
                        } else {
                            return "无"
                        }
                    }
                },
                {field: 'returnArea', title: '返程地区', align: 'center',width:90, templet:function(d) {
                        if (d.returnStatus == "0") {
                            return "无"
                        }  else {
                            return d.returnArea;
                        }
                }},
                {
                    field: 'epidemicArea', title: '是否经过疫区', align: 'center',width:150, templet: function (d) {
                        if (d.returnStatus == "0") {
                            return "否"
                        }  else if (d.epidemicArea == null || d.epidemicArea == undefined || d.epidemicArea == "undefined" || d.epidemicArea == "") {
                            return "否";
                        } else {
                            return page.aceeptDictContentName(dictData, 'epidemicArea', d.epidemicArea);
                        }
                    }
                },
                {
                    field: 'verifyStatus', title: '审核状态', align: 'center',width:150, templet: function (d) {
                        return page.aceeptDictContentName(dictData, 'person_verify_status', d.verifyStatus);
                    }
                },
                {title: '操作', width: 320, templet: '#entityBar', align: "center",fixed: 'right'}
            ];
            tableIns = page.initDate(cols, url);
        });

        //var catData = [{"id":1,"name":"周边旅游","children":[{"id":24,"name":"广东","status":0,"children":[{"id":7,"name":"广州"},{"id":23,"name":"潮州"}]}]},{"id":5,"name":"国内旅游","children":[{"id":8,"name":"华北地区","children":[{"id":9,"name":"北京"}]}]},{"id":6,"name":"出境旅游","children":[{"id":10,"name":"东南亚","children":[{"id":11,"name":"马来西亚","children":[{"id":20,"name":"沙巴","children":[{"id":21,"name":"美人鱼岛","children":[{"id":22,"name":"潜水"}]}]}]}]}]}];

        //无限级分类-基本配置
        /*var catIns1 = selectN({
            //元素容器【必填】
            elem: '#cat_ids1'
            ,search:true
            //候选数据【必填】
            ,data: catData
        });*/

        // 导出
        form.on('submit(exportBtn)', function (data) {
            var name = data.field.name;
            var mobile = data.field.mobile;
            var idCard = data.field.idCard;
            var returnStatus = data.field.returnStatus;
            var epidemicArea = data.field.epidemicArea;
            window.location.href = "/work/antiepidemic/antiepidemicperson/exportExcel?name="+name+"&mobile="+mobile+"&idCard="+idCard+
                "&returnStatus="+returnStatus+"&epidemicArea="+epidemicArea;
        });

        //监听行工具事件
        table.on('tool(entityList)', function (obj) {
            var layEvent = obj.event,
                data = obj.data;
            if (layEvent === 'edit') {
                page.editPopup('/work/antiepidemic/antiepidemicperson/getEdit?applyId=${applyId}&id=' + data.id, '编辑');
            }
            if (layEvent === 'record') {
                page.edit("recordList","/work/antiepidemic/antiepidemicrecord/getAntiepidemicRecordList?personId="+data.id,"出入小区记录");
            }
            if (layEvent === 'temperature') {
                page.edit("temperatureList","/work/antiepidemic/antiepidemictemperature/getAntiepidemicTemperatureList?personId="+data.id,"健康管理");
            }
            if (layEvent === 'delete') {
                page.delete('/work/antiepidemic/antiepidemicperson/remove', {"id": data.id, "_method": "DELETE"}, "确定删除吗？", function () {
                    tableIns.reload();
                });
            }
        });

        //监听审核按钮事件，选择需要提交的按钮
        $('#checkYesBtn').bind('click', function () {
            var data = table.checkStatus('entityList').data;
            if (data.length === 0) {
                dialog.msg("请先选择对象");
                return false;
            } else {
                var ids = [];
                for (var i = 0; i < data.length; i++) {
                    ids.push(data[i].id)
                }
                page.delete('/work/antiepidemic/antiepidemicperson/checkYes', {"ids": ids.join(","), "verifyStatus": "1"}, "您确定要审核通过吗？", function () {
                    table.reload("entityList", {
                        where: {}
                    });
                });
            }
        });

        $('#checkNoBtn').bind('click', function () {
            var data = table.checkStatus('entityList').data;
            if (data.length === 0) {
                dialog.msg("请先选择对象");
                return false;
            } else {
                var ids = [];
                for (var i = 0; i < data.length; i++) {
                    ids.push(data[i].id)
                }
                page.delete('/work/antiepidemic/antiepidemicperson/checkNo', {"ids": ids.join(","), "verifyStatus": "2"}, "您确定要审核不通过吗？", function () {
                    table.reload("entityList", {
                        where: {}
                    });
                });
            }
        });

        //监听删除按钮事件
        $('#deleteBtn').bind('click', function () {
            var data = table.checkStatus('entityList').data;
            if (data.length === 0) {
                dialog.msg("请先选择对象");
                return false;
            } else {
                var ids = [];
                for (var i = 0; i < data.length; i++) {
                    ids.push(data[i].id)
                }
                page.delete('/work/antiepidemic/antiepidemicperson/remove', {"id": ids.join(","), "_method": "DELETE"}, "您确定要删除吗？", function () {
                    table.reload("entityList", {
                        where: {}
                    });
                });
            }
        });
    });
</script>
</body>
</html>